<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="../../lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
    <link rel="stylesheet" href="../../css/public.css" media="all">
    <style>
        body {
            background-color: #ffffff;
        }
        .layui-iconpicker-body.layui-iconpicker-body-page .hide {display: none;}
    </style>
</head>
<body>
<form class="layui-form layuimini-form">
    <div class="layui-form-item">
        <label class="layui-form-label required">快捷名称</label>
        <div class="layui-input-block">
            <input type="text" name="title" lay-verify="required" lay-reqtext="快捷名称不能为空" placeholder="请输入快捷名称"class="layui-input">
        </div>
    </div>
	<div class="layui-form-item">
	    <label class="layui-form-label required">选择图标</label>
	    <div class="layui-input-block">
	        <input type="text" name="icon" id="iconPicker" lay-verify="required" lay-reqtext="图标不能为空" class="hide">
	    </div>
	</div>
	<div class="layui-form-item">
	    <label class="layui-form-label required">快捷链接</label>
	    <div class="layui-input-block">
	        <input type="text" name="href" lay-verify="required" lay-reqtext="快捷链接不能为空" placeholder="请选择快捷链接"class="layui-input">
	    </div>
	</div>
	<div class="layui-form-item">
	    <label class="layui-form-label">备注信息</label>
	    <div class="layui-input-block">
	        <textarea name="remark" class="layui-textarea"></textarea>
	    </div>
	</div>
    <div class="layui-form-item text-center">
        <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
        <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
    </div>
</form>
<script src="../../lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script src="../../js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script>
    layui.use(['iconPickerFa', 'form', 'layer'], function () {
        var iconPickerFa = layui.iconPickerFa,
		    form = layui.form,
            layer = layui.layer,
            $ = layui.$;
			
		iconPickerFa.render({
		    // 选择器，推荐使用input
		    elem: '#iconPicker',
		    // fa 图标接口
		    url: "../../lib/font-awesome-4.7.0/less/variables.less",
		    // 是否开启搜索：true/false，默认true
		    search: true,
		    // 是否开启分页：true/false，默认true
		    page: true,
		    // 每页显示数量，默认12
		    limit: 12,
		    // 点击回调
		    click: function (data) {
		        console.log(data);
		    },
		    // 渲染成功后的回调
		    success: function (d) {
		        console.log(d);
		    }
		});
        //监听提交
        form.on('submit(saveBtn)', function (data) {
            var index = layer.alert(JSON.stringify(data.field), {
                title: '最终的提交信息'
            }, function () {

                // 关闭弹出层
                layer.close(index);

                var iframeIndex = parent.layer.getFrameIndex(window.name);
                parent.layer.close(iframeIndex);

            });

            return false;
        });
		
		

    });
</script>
</body>
</html>